// 版本+日期配置
const type = 3;
const releaseVersion = 20250228;

const config = {
  appId: 'f7f57ca135a611e9aa7900163e06f83c',
  // 微信公众号 appid
  // wxH5AppId: 'wx6176fed562a02ee2',
  // 高德地图key
  // mapH5Key: '592ce2d45b819999b91ddc5ec12909cd',
  mapH5Key: 'e317c3dee90323bc2cfe1856b97f9b01',
  mapQQH5Key: 'OCPBZ-2EEWU-H3EV5-BLU4T-Y3YP5-DABXT',
  // 小程序原始id
  wxMpOriginalId: 'gh_8906b0540c7b', // 新主体
  corpId: 'wwc9d424eb4967f7cd', // 企业微信 企业id
  // 图片路径
  imagePrefix: '/static/img/',
  // h5压缩图片-设置目标文件大小，单位为KB，根据需求调整
  targetSizeKB: 150,

  type,
  releaseVersion,
};

if (type == 1) {
  // 测试
  config.baseUrl = 'https://wxopen.sk1999.com/api/';
  config.payUrl = 'https://wxopen.sk1999.com/api/';
  config.shopApiUrl = 'https://wxopen.sk1999.com/api/';
  config.shareDomain = 'https://wxopen.sk1999.com/admin/';
  config.imagePrefix = '/static/img/';
} else if (type == 2) {
  // 预览
  config.baseUrl = 'https://wxopen.sk1999.com/api/';
  config.payUrl = 'https://wxopen.sk1999.com/api/';
  config.shopApiUrl = 'https://wxopen.sk1999.com/api/';
  config.shareDomain = 'https://wxopen.sk1999.com/admin/';
  config.imagePrefix = '/static/img/';
} else if (type == 3) {
  // 正式
  config.baseUrl = 'https://wxopen.sk1999.com/api/';
  config.payUrl = 'https://wxopen.sk1999.com/api/';
  config.shopApiUrl = 'https://wxopen.sk1999.com/api/';
  config.shareDomain = 'https://wxopen.sk1999.com/admin/';
  config.imagePrefix = '/static/img/';
}

config.defaultAppShareIcon = `${config.imagePrefix}logo50x50.jpg`;
config.defaultMpShareIcon = `${config.imagePrefix}logo750x600.jpg`;
config.authLogo = `${config.imagePrefix}logo260x260.jpg`;

export function mergeConfig() {
  // #ifdef H5
  config.clientplatform = 'webapp';
  // #endif

  // #ifdef MP-WEIXIN
  config.clientplatform = 'wxmini';
  // #endif

  // #ifdef MP-WEIXIN || H5
  config.clientversion = config.releaseVersion;
  // #endif

  // #ifdef APP-PLUS
  // const alreadyAgree = uni.getStorageSync('alreadyAgreePrivacyAgreement');
  const alreadyAgree = plus.runtime.isAgreePrivacy() ? 1 : 0;
  uni.setStorageSync('alreadyAgreePrivacyAgreement', alreadyAgree);
  if (alreadyAgree) {
    config.clientplatform = uni.getSystemInfoSync().platform;
    config.clientversion = plus.runtime.version;
  }
  // #endif

  // #ifdef H5
  config.isWeiXinBrowser = (() => {
    const ua = window.navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == 'micromessenger') {
      return true;
    }
    return false;
  })();
  // #endif

  // #ifndef H5
  config.isWeiXinBrowser = false;
  // #endif
}

mergeConfig();

export default config;
// module.exports = config;
